import service from "@/utils/request";

export function getBoardListService(params) {
    return service({
      url: "/board/list",
      method: "get",
      params: {
        ...params,
        // 确保后端能接收 sortOrder 参数
        orderBy: params.sortOrder === 'asc' ? 'sort asc' : 'sort desc'
      },
    });
  }

export function addBoardService(data) {
  return service({
    url: "/board/add",
    method: "post",
    data,
  });
}

export function updateBoardService(data) {
  return service({
    url: "/board/update",
    method: "post",
    data,
  });
}

export function deleteBoardService(boardId) {
  return service({
    url: `/board/delete/${boardId}`,
    method: "delete",
  });
}

export function batchUpdateSortService(data) {
  return service({
    url: "/board/batchUpdateSort",
    method: "post",
    data,
  });
}